package lab03.test08;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class test08 {
    public static void main(String[] args) throws IOException {
        File f = new File("D:\\test3.txt");

        if(!f.exists()){
            f.createNewFile();
        }

        String f1 = "D:\\Test.txt";
        String f2 = "D:\\test2.txt";
        //使用字节流来读写文件（读一个字节写一个字节）
        FileInputStream fileInputStream = new FileInputStream(f1);
        FileInputStream fileInputStream1 = new FileInputStream(f2);
        FileOutputStream fileOutputStream = new FileOutputStream(f);

        int data;
        //输出是写，输入是读
        while ((data = fileInputStream.read()) != -1||(data = fileInputStream1.read()) != -1) {
            fileOutputStream.write(data);
        }

    }
}
